<template>
 <div>
<!-- 面包屑 -->
  <el-breadcrumb separator="/">
  <el-breadcrumb-item :to="{ path: '/welcome' }"><span >首页</span></el-breadcrumb-item>
  <!-- <el-breadcrumb-item><a href="/">活动管理</a></el-breadcrumb-item> -->
  <el-breadcrumb-item>权限管理</el-breadcrumb-item>
  <el-breadcrumb-item>权限列表</el-breadcrumb-item>
</el-breadcrumb>
<!-- 卡片 -->
<el-card >
     <el-table
      :data="rightsList"
      style="width: 100%" border stripe>
      <el-table-column prop="id" label="#" type="index"></el-table-column>
      <el-table-column
        prop="authName"
        label="权限名称">
      </el-table-column>
      <el-table-column
        prop="path"
        label="路径">
      </el-table-column>
      <el-table-column
        prop="level"
        label="权限等级">
        <template slot-scope="data">
          <el-tag v-if="data.row.level==0" size="small">标签一</el-tag>
          <el-tag type="success" v-else-if="data.row.level==1" size="small">标签二</el-tag>
          <el-tag type="warning" v-else size="small">标签三</el-tag>
        </template>
      </el-table-column>
    </el-table>
</el-card >
 </div>
</template>

<script>
export default {
  data () {
    return {
      rightsList: []
    }
  },
  created () {
    this.getRightsList()
  },
  methods: {
    async getRightsList () {
      const { data: res } = await this.$http.get('rights/list')
      if (res.meta.status !== 200) return this.$notify.error({ title: '错误', message: res.meta.msg })
      this.rightsList = res.data
    }
  }
}
</script>

<style lang="less" scoped>
.el-breadcrumb {
  margin-bottom: 20px;
}
</style>
